package org.jfonia.connect5.intervals;

import org.jfonia.connect5.basics.BasicValueNode;
import org.jfonia.connect5.basics.BasicNode;
import org.jfonia.connect5.basics.MutableValueNode;
import org.jfonia.connect5.numerical.IntSumRelation;

/**
 *
 *
 * @author wijnand.schepens@hogent.be
 */
public class BasicIntInterval extends BasicNode implements Interval<Integer>
{
	protected MutableValueNode<Integer> begin;
	protected MutableValueNode<Integer> end;
	protected MutableValueNode<Integer> difference;

	public BasicIntInterval()
	{
		begin = new BasicValueNode<Integer>(0);
		end = new BasicValueNode<Integer>(0);
		difference = new BasicValueNode<Integer>(0);

		new IntSumRelation(begin, difference, end);
	}

	public Integer getBegin()
	{
		return begin.getValue();
	}

	public BasicIntInterval setBegin(int value)
	{
		begin.setValue(value);
		return this;
	}

	public Integer getEnd()
	{
		return end.getValue();
	}

	public BasicIntInterval setEnd(int value)
	{
		end.setValue(value);
		return this;
	}

	public Integer getDifference()
	{
		return difference.getValue();
	}

	public BasicIntInterval setDifference(int value)
	{
		difference.setValue(value);
		return this;
	}

	public MutableValueNode<Integer> getBeginNode()
	{
		return begin;
	}

	public MutableValueNode<Integer> getEndNode()
	{
		return end;
	}

	public MutableValueNode<Integer> getDifferenceNode()
	{
		return difference;
	}
}
